<% @page_title = "小组讨论 | 多背一公斤 - 灾后学校重建计划" -%>

<% content_for :sidebar do -%>
  <div class="bulletin" style="font-size:1.2em">
    <div style="text-align:center"><h2>全部讨论组</h2></div>
    <%= render :partial => "all_groups" %>
  </div>
<% end -%>

<h1>最新话题</h1>
<table border="0" cellspacing="0" cellpadding="5" class="left ol" width="100%">
  <tr>
    <th width="200">标题</th>
    <th>小组</th>
    <th>作者</th>
    <th>回复</th>
    <th>最后回复</th>
  </tr>
  <% @topics.each do |topic| -%>
  <tr>
    <td><%= link_to_group_topic_page topic, :target => '_blank' %></td>
    <td><%= link_to_group_page topic.group.title, topic.group.id %></td>
    <td><%= link_to_user_page topic.user, :target => "_blank" %></td>
    <td><span class="tip"><%= topic.posts_count %></span></td>
    <td>
      <% if topic.posts_count > 0 -%>
        <span class="tip"><%= topic.replied_by_user.login %>@<%= show_date topic.replied_at %></span>
      <% end -%>
    </td>
  </tr>
  <% end -%>
</table>
<%= will_paginate @topics %>
<div class="clear"></div>